#!/bin/sh
# 安装
yum install -y git
yum install -y zsh
yum install -y tmux
yum install -y util-linux-user
# 插件管理器 Oh My Zsh安装
curl https://gitee.com/XYLongzzZ/msh/raw/master/file/omz-install.sh -o -|sh

# 插件下载
git clone http://github.com.cnpmjs.org/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone http://github.com.cnpmjs.org/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone http://github.com.cnpmjs.org/zsh-users/zsh-history-substring-search.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

# 插件配置
#sed -i 's/^ZSH_THEME=.*/ZSH_THEME="bureau"/' ~/.zshrc
sed -i 's/^plugins=.*/plugins=(z sudo git tmux docker zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search)/' ~/.zshrc

# 开启终端256色
echo 'if [ "$TERM"=="xterm" ]; then' >> ~/.zshrc
echo '    export TERM=xterm-256color' >> ~/.zshrc
echo 'fi' >> ~/.zshrc

# 生效
chsh -s /bin/zsh
zsh
source ~/.zshrc